---
title: Modal | gluestack-ui | Installation, Usage, and API

description: A Modal is a window on top of the primary content to draw the user's attention to important information or actions. It provides a focused and interruptive way to interact with the application.

pageTitle: Modal

pageDescription: A Modal is a window on top of the primary content to draw the user's attention to important information or actions. It provides a focused and interruptive way to interact with the application.

showHeader: true
---

import { Meta } from '@storybook/addon-docs';

<Meta title="ui/Components/Overlay/Modal" />

import {
  CloseIcon,
  Button,
  ButtonText,
  ButtonIcon,
  Heading,
  Icon,
} from './Modal';
import {
  Text as ModalText,
  Modal,
  ModalBackdrop,
  ModalContent,
  ModalHeader,
  ModalCloseButton,
  ModalBody,
  ModalFooter,
  Center,
  CheckCircleIcon,
} from './Modal';
import {
  VStack,
  HStack,
  Input,
  InputField,
  ArrowLeftIcon,
  Link,
} from './Modal';
import { transformedCode } from '../../../utils';
import { useState } from 'react';
import {
  AppProvider,
  CodePreview,
  Table,
  TableContainer,
  AddIcon,
  InfoIcon,
  InlineCode,
} from '@gluestack/design-system';

import Wrapper from '../../Wrapper';

This is an illustration of a **Themed Modal** component with default configuration.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
        function App(){
          const [showModal, setShowModal] = useState(false);
          console.log(showModal);
          const ref = React.useRef(null);
          return (
            <Center h={300}>
              <Button onPress={() => setShowModal(true)} ref={ref}>
                <ButtonText>Show Modal</ButtonText>
              </Button>
              <Modal
                isOpen={showModal}
                onClose={() => {
                  setShowModal(false);
                }}
                finalFocusRef={ref}
              >
                <ModalBackdrop />
                <ModalContent>
                  <ModalHeader>
                    <Heading size='lg'>Engage with Modals</Heading>
                    <ModalCloseButton>
                      <Icon as={CloseIcon} />
                    </ModalCloseButton>
                  </ModalHeader>
                  <ModalBody>
                    <Text >
                  Elevate user interactions with our versatile modals. Seamlessly integrate notifications, forms, and media displays. Make an impact effortlessly.
                    </Text>
                  </ModalBody>
                  <ModalFooter>
                    <Button
                      variant="outline"
                      size="sm"
                      action="secondary"
                      mr="$3"
                      onPress={() => {
                        setShowModal(false);
                      }}
                    >
                      <ButtonText>Cancel</ButtonText>
                    </Button>
                    <Button
                      size="sm"
                      action="positive"
                      borderWidth='$0'
                      onPress={() => {
                        setShowModal(false);
                      }}
                    >
                      <ButtonText>Explore</ButtonText>
                    </Button>
                  </ModalFooter>
                </ModalContent>
              </Modal>
            </Center>
          );
        }
      `,
      transformCode: (code) => {
        return transformedCode(code, 'function', 'App');
      },
      scope: {
        Wrapper,
        Modal,
        ModalBackdrop,
        ModalContent,
        ModalHeader,
        ModalCloseButton,
        ModalBody,
        ModalFooter,
        useState,
        CloseIcon,
        Button,
        ButtonText,
        Heading,
        Center,
        Text: ModalText,
        Icon,
      },
      argsType: {},
    }}
  />
</AppProvider>

<br />

## API Reference

### Import

To use this component in your project, include the following import statement in your file.

```jsx
import { Modal } from '@gluestack-ui/themed';
```

### Anatomy

The structure provided below can help you identify and understand a Modal component's various parts.

```jsx
export default () => (
  <Modal>
    <ModalBackdrop />
    <ModalContent>
      <ModalHeader>
        <ModalCloseButton></ModalCloseButton>
      </ModalHeader>
      <ModalBody />
      <ModalFooter />
    </ModalContent>
  </Modal>
);
```

### Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

#### Modal

Contains all View related layout style props and actions. It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view#props) component.

<AppProvider>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Prop</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Type</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Default</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Description</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isOpen</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>boolean</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`If true, the modal will open. Useful for controllable state behavior.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>onClose</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`() => any`}</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`Callback invoked when the modal is closed.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>useRNModal</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>boolean</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`If true, renders react-native native modal.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>defaultIsOpen</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>boolean</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`Specifies the default open state of the Modal`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>initialFocusRef</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`React.RefObject<any>`}</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`The ref of element to receive focus when the modal opens.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>finalFocusRef</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`React.RefObject<any>`}</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`The ref of element to receive focus when the modal closes`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>avoidKeyboard</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>boolean</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`If true, the Modal will avoid the keyboard.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>closeOnOverlayClick</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>boolean</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`If true, the Modal will close when the overlay is clicked.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isKeyboardDismissable</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>boolean</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`If true, the keyboard can dismiss the Modal`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>children</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>any</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`The content to display inside the Modal`}</Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>
  </TableContainer>
</AppProvider>

**Descendants Styling Props**
Props to style child components.

<AppProvider>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Sx Prop</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Description</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>_content</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`Prop to style ModalContent Component`}</Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>
  </TableContainer>
</AppProvider>

#### ModalBackdrop

It is React Native's [Pressable](https://reactnative.dev/docs/pressable#props) component, created using [@legendapp/motion's](https://legendapp.com/open-source/motion/) `createMotionAnimatedComponent` function to add animation to the component. You can use any declarative animation library you prefer.

#### ModalContent

It is [@legendapp/motion's](https://legendapp.com/open-source/motion/) [Motion.View](https://legendapp.com/open-source/motion/overview/) component. You can use any declarative animation library you prefer.

<AppProvider>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Prop</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Type</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Default</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Description</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>focusable</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>boolean</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`If true, Modal Content will be focusable.`}</Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>
  </TableContainer>
</AppProvider>

#### ModalHeader

It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component.

#### ModalCloseButton

It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component.

**Descendants Styling Props**
Props to style child components.

<AppProvider>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Sx Prop</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Description</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>_text</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`Prop to style ModalCloseButton  Text Component`}</Table.TText>
          </Table.TD>
        </Table.TR>
         <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>_icon</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`Prop to style ModalCloseButton  Icon Component`}</Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>

  </TableContainer>
</AppProvider>

#### ModalBody

It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component.

#### ModalFooter

It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component.

### Accessibility

We have outlined the various features that ensure the Modal component is accessible to all users, including those with disabilities. These features help ensure that your application is inclusive and meets accessibility standards. It uses React Native ARIA [@react-native-aria/focus](https://react-native-aria.geekyants.com/docs/) which follows the [Dialog Modal WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/).

## Themed

The themed version of the component is a pre-styled version of the component, which allows you to quickly integrate the component into your project. The component's design and functionality are fully defined, allowing you to focus on the more important aspects of your project. To know more about Themed Library please visit this [link](https://gluestack.io/ui/docs/core-concepts/themed-library).

### Props

Modal component is created using View component from react-native. It extends all the props supported by [React Native View](https://reactnative.dev/docs/view#props), [utility props](/ui/docs/styling/utility-and-sx-props) and the props mentioned below.

#### Modal

<AppProvider>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Name</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Value</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Default</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>size</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>xs | sm | md | lg | full</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>md</Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>
  </TableContainer>
</AppProvider>

> Note: These props are exclusively applicable when utilizing the default configuration of gluestack-ui/config. If you are using a custom theme, these props may not be available.

### Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

#### Multiple Modals

A user interface featuring multiple modal components that allow for layered interaction and context-specific information display.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
        function App() {
          const [showModal, setShowModal] = useState(false);
          const [showModal2, setShowModal2] = useState(false);
          const [showModal3, setShowModal3] = useState(false);
          return (
            <Center>
              <Center h={400}>
                <Button onPress={() => setShowModal(true)}>
                  <ButtonText>Forgot password?</ButtonText>
                </Button>
              </Center>
              <Modal
                isOpen={showModal}
                onClose={() => {
                  setShowModal(false);
                }}
              >
                <ModalBackdrop />
                <ModalContent>
                  <ModalHeader borderBottomWidth='$0'>
                  <VStack space='sm'>
                    <Heading size='lg'>Forgot password?</Heading>
                    <Text size='sm'>No worries, we’ll send you reset instructions</Text>
                    </VStack>
                  </ModalHeader>
                  <ModalBody>
                    <Input>
                      <InputField placeholder="Enter your email" />
                    </Input>
                  </ModalBody>
                  <ModalFooter borderTopWidth='$0'>
                    <VStack space='lg' w='$full'>
                      <Button
                        onPress={() => {
                          setShowModal2(true);
                        }}
                      >
                        <ButtonText>Submit</ButtonText>
                      </Button>
                      <HStack>
                        <Button
                          variant='link'
                          size='sm'
                          onPress={() => {
                            setShowModal(false);
                          }}
                        >
                          <ButtonIcon as={ArrowLeftIcon}/>
                          <ButtonText >Back to login</ButtonText>
                        </Button>
                      </HStack>
                    </VStack>
                  </ModalFooter>
                </ModalContent>
              </Modal>
              <Modal
                isOpen={showModal2}
                onClose={() => {
                  setShowModal2(false);
                }}
              >
                <ModalBackdrop />
                <ModalContent>
                  <ModalHeader borderBottomWidth='$0'>
                  <VStack space='sm'>
                    <Heading size='lg'>Reset password</Heading>
                    <Text size='sm'>A verification code has been sent to you. Enter code below.</Text>
                    </VStack>
                  </ModalHeader>
                  <ModalBody>
                    <Input>
                      <InputField placeholder="Enter verification code" />
                    </Input>
                  </ModalBody>
                  <ModalFooter borderTopWidth='$0'>
                  <VStack space='lg' w='$full'>
                    <Button
                      onPress={() => {
                        setShowModal3(true);
                      }}
                    >
                      <ButtonText>Continue</ButtonText>
                    </Button>
                    <Text size='sm'>Didn’t receive the email?
                      <Link ml='$1'><Link.Text size='sm' 
                      $dark-color='$textDark200'
                      color='$textLight700'
                      fontWeight='$semibold'>Click to resend</Link.Text></Link>
                    </Text>
                    <HStack space='xs' alignItems='center'>
                      <Button
                        variant='link'
                        size='sm'
                        onPress={() => {
                          setShowModal2(false);
                        }}
                      >
                        <ButtonIcon as={ArrowLeftIcon}/>
                        <ButtonText >Back to login</ButtonText>
                      </Button>
                    </HStack>
                    </VStack>
                  </ModalFooter>
                </ModalContent>
              </Modal>
              <Modal
                isOpen={showModal3}
                onClose={() => {
                  setShowModal3(false);
                }}
              >
                <ModalBackdrop />
                <ModalContent>
                  <ModalHeader borderBottomWidth='$0'>
                  <VStack space='sm'>
                    <Heading size='lg'>Set new password</Heading>
                    <Text size='sm'>Almost done. Enter your new password and you are all set.</Text>
                    </VStack>
                  </ModalHeader>
                  <ModalBody>
                  <VStack space='xl'>
                    <Input>
                      <InputField placeholder="New password" />
                    </Input>
                    <Input>
                      <InputField placeholder="Confirm new password" />
                    </Input>
                    </VStack>
                  </ModalBody>
                  <ModalFooter borderTopWidth='$0'>
                  <VStack space='lg' w='$full'>
                    <Button
                      onPress={() => {
                        setShowModal(false);
                        setShowModal2(false);
                        setShowModal3(false);
                      }}
                    >
                      <ButtonText>Submit</ButtonText>
                    </Button>
                    <HStack space='xs' alignItems='center'>
                      <Button
                        variant='link'
                        size='sm'
                        onPress={() => {
                          setShowModal3(false);
                        }}
                      >
                        <ButtonIcon as={ArrowLeftIcon}/>
                        <ButtonText >Back to login</ButtonText>
                      </Button>
                    </HStack>
                    </VStack>
                  </ModalFooter>
                </ModalContent>
              </Modal>
            </Center>
          );
        }
      `,
      transformCode: (code) => {
        return transformedCode(code, 'function', 'App');
      },
      scope: {
        Modal,
        ModalBackdrop,
        ModalContent,
        ModalHeader,
        ModalCloseButton,
        ModalBody,
        ModalFooter,
        Wrapper,
        useState,
        Button,
        ButtonText,
        ButtonIcon,
        Text: ModalText,
        Center,
        CloseIcon,
        VStack,
        HStack,
        Heading,
        Icon,
        Input,
        InputField,
        Link,
        ArrowLeftIcon,
      },
      argsType: {},
    }}
  />
</AppProvider>

### Modal sizes

A versatile modal component offering different sizes to accommodate various content types and optimize user experience.

<AppProvider>
  <CodePreview
    showArgsController={false}
    metaData={{
      code: `
      function App(){
        const [showModal, setShowModal] = React.useState(false);
        const [size, setSize] = React.useState(undefined);
        const sizes = ['xs', 'sm', 'md', 'lg', 'full']
        const ref = React.useRef(null);
        const handleClick = (currentSize) => {
          setShowModal(true)
          setSize(currentSize)
        }
        return (
            <Center h={400}>
            <VStack space='md'>
            {sizes.map((currentSize) => {
                return <Button key={currentSize} onPress={() => handleClick(currentSize)}>
                  <ButtonText>{currentSize}</ButtonText>
                </Button>
            })}
                </VStack>
                <Modal
                  isOpen={showModal}
                  onClose={() => {
                    setShowModal(false);
                  }}
                size={size}
                  finalFocusRef={ref}
                >
                  <ModalBackdrop />
                  <ModalContent>
                    <ModalHeader>
                      <Heading size='lg'>Delete Folder</Heading>
                      <ModalCloseButton>
                        <Icon as={CloseIcon} />
                      </ModalCloseButton>
                    </ModalHeader>
                    <ModalBody>
                      <Text size="sm">
                      Whoa, slow down there! This modal is like a red light at an intersection, reminding you to stop and think before you proceed. Is deleting this folder the right choice?
                      </Text>
                    </ModalBody>
                    <ModalFooter>
                      <Button
                        variant="outline"
                        size="sm"
                        action="secondary"
                        mr="$3"
                        onPress={() => {
                          setShowModal(false);
                        }}
                      >
                        <ButtonText>Cancel</ButtonText>
                      </Button>
                      <Button
                        size="sm"
                        action="primary"
                        borderWidth='$0'
                        onPress={() => {
                          setShowModal(false);
                        }}
                        bg="$error700"
                        $hover-bg="$error800"
                        $active-bg="$error900"
                      >
                        <ButtonText>Explore</ButtonText>
                      </Button>
                    </ModalFooter>
                  </ModalContent>
                </Modal>
              </Center>
          );
        }
      `,
      transformCode: (code) => {
        return transformedCode(code, 'function', 'App');
      },
      scope: {
        Wrapper,
        Modal,
        ModalBackdrop,
        ModalContent,
        ModalHeader,
        ModalCloseButton,
        ModalBody,
        ModalFooter,
        useState,
        CloseIcon,
        Button,
        ButtonText,
        Heading,
        Center,
        Text: ModalText,
        Icon,
        VStack,
        HStack,
      },
      argsType: {
        size: {
          control: 'select',
          options: ['xs', 'sm', 'md', 'lg', 'full'],
          default: 'md',
        },
      },
    }}
  />
</AppProvider>

## Unstyled

All the components in `gluestack-ui` are unstyled by default. To customize your UI using the extendedTheme, please refer to this [link](https://gluestack.io/ui/docs/theme-configuration/customizing-theme/eject-library). The import names of components serve as keys to customize each component.

## Spec Doc

Explore the comprehensive details of the Modal in this document, including its implementation details, checklist, and potential future additions. Dive into the thought process behind the component and gain insights into its development journey.

<iframe
  style={{
    borderRadius: '8px',
    border: ' 1px solid rgba(0, 0, 0, 0.1)',
    aspectRatio: 736 / 585,
  }}
  src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Fproto%2FNcXOxqKbdnGsLQNex3H76u%2F%25C2%25A0%25F0%259F%2593%259Agluestack-UI-handbook%3Fpage-id%3D5231%253A20810%26type%3Ddesign%26node-id%3D5235-29102%26viewport%3D490%252C241%252C0.02%26t%3DFWIfjvKo1mfJez7E-1%26scaling%3Dcontain%26starting-point-node-id%3D5235%253A29102%26mode%3Ddesign"
  allowFullScreen
/>

<!--

### Advanced

We provide in-depth information on how to customize and extend the component's functionality to meet your needs. Below, we describe how to modify the component to suit your requirements.

### Customizing the Modal

We have a function called `createModal` which can be used to create a custom Modal component. This function takes in a configuration object which contains the styled components that you want to use for the modal. You can refer [gluestack.io/style](/style) for more information on how to use styled components.

You can read more on how to animate components [here](/ui/docs/advanced/animations).

#### Usage

Default styling of all these components can be found in the `components/core/modal` file. For reference, you can view the [source code](https://github.com/gluestack/gluestack-ui/blob/main/packages/themed/src/components/Modal) of the styled `Modal` components.

```jsx
// import the styles
import {
  Root,
  Content,
  CloseButton,
  Header,
  Footer,
  Body,
  Backdrop,
} from '../components/core/modal/styled-components';

// import the createModal function
import { createModal } from '@gluestack-ui/modal';

// Understanding the API
const Modal = createModal({
  Root,
  Content,
  CloseButton,
  Header,
  Footer,
  Body,
  Backdrop,
  AnimatePresence: Content.AnimatePresence, // Can be AnimatePresence from the library you are using
});

// Using the modal component
export default () => (
  <Modal>
    <ModalBackdrop />
    <ModalContent>
      <ModalHeader>
        <Heading size="lg">Confirm your request</Heading>
        <ModalCloseButton>
          <CloseIcon />
        </ModalCloseButton>
      </ModalHeader>
      <ModalBody>
        <Text size="sm">Modal Body</Text>
      </ModalBody>
      <ModalFooter>
        <Button>
          <ButtonText></ButtonText>
        </Button>
        <Button>
          <ButtonText></ButtonText>
        </Button>
      </ModalFooter>
    </ModalContent>
  </Modal>
);
```
-->
